how to add an array into an associative array in php

108

// for php 5.4+
$data += [$key => $value];

// for php 5.4-
$data += array($key => $value);
$a = array('foo' => 'bar'); // when you create
$a['Title'] = 'blah'; // later
$data[$category][] = $item;

Comments

Submit
0 Comments